<?php


namespace App\Controller;

use App\Model\Industry;
use App\Service\Gaode\api\Place;
use App\Service\Gaode\ApiClient;

/**
 * 位置查询
 * Class LocationQueryController
 * @package App\Controller
 */
class LocationQueryController extends AbstractController
{
    /**
     * poi查询
     * around
     * @param ApiClient $apiClient
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \GuzzleHttp\Exception\GuzzleException
     * date:2022/7/13
     * time:15:06
     * auth：xyc
     */
    public function around(ApiClient $apiClient)
    {
        $params = $this->request->inputs(['location', 'keywords', 'page', 'offset']);
        $json = $apiClient->request((new Place())->around($params['location'] ?? "", $params['keywords'] ?? "", intval($params['keywords'] ?? 1), intval($params['offset'] ?? 20)));
        return $this->jsonResponse->success(json_decode($json));
    }

}